This invention relates to a method and apparatus for data compression and restoration, and particularly to a method and apparatus for data compression and restoration applicable to sequential file units, such as magnetic tape units, which allow data writing in the forward and reverse directions on a recording medium.
A conventional data compressing method for a magnetic tape memory unit implements data compression using 4-byte dictionary data when the same data is repeated for five, bytes, or more, as described in U.S. Pat. No. 4,586,027. In this method, the dictionary data is made up of a value indicating the distance from the previous dictionary data to the current dictionary data, the number of repetitive data, and a value indicating the distance to the next dictionary data. However, this conventional method does not consider the case of repetitive data of 4 bytes or less included in the input data. The frequency of occurrence of repetitive data of 4 bytes or less is higher by four to 20 times than that of 5 bytes or more, and its occurrence rate as the whole is as high as 10%, resulting in the difficulty in improving a compression factor. Another problem is that if an error arises even once in the dictionary data during the restoration process, restoration for subsequent data is not guaranteed.